package cls.inner;

/**
 * @author mubei
 * @date 2021/12/21
 * @description 演示 匿名内部类
 */
public class AnonymousInnerClass {

    public static void main(String[] args) {
        // 接口匿名内部类
        A a = new A(){
            @Override
            public void cry() {
                System.out.println("匿名内部类哭唧唧...");
            }
        };
        a.cry();
        System.out.println(a.getClass());


        //类 匿名内部类
        Human human = new Human(){
            @Override
            public void cry() {
                super.cry();
                System.out.println("重写喽");
            }
        };
        human.cry();

    }

}

class Outer02 {
    private int n1 = 10;

    public void m1() {
        // 基于接口的匿名内部类

    }
}

interface A{
    public void cry();
}

class Human implements A {

    @Override
    public void cry() {
        System.out.println("Human哭唧唧....");
    }
}